library(tidyverse)
library(readxl)
path = "files/2025-10-12/Challenge 70.xlsx"
input = read_excel(path, range = "B2:C12")
test = read_excel(path, range = "E2:F6")
result = input %>%
mutate(Item = paste0("Group ",cumsum(str_detect(Item, "Group")))) %>%
summarise(Prices = sum(Prices,na.rm = TRUE), .by = Item)
all.equal(result, test)
# [1] TRUECrispo - Excel Challenge 41 2025
excel-challenges
weekly-exercises
Easy Sunday Excel Challenge

Challenge Description
Easy Sunday Excel Challenge
⭐ Group 1 Group 2 Group 3 Group 4 and filter outs sub items ⭐For example Group 1 = 100+25+20
Solutions
Logic:
Reads the workbook range needed for the challenge
Aggregates or ranks values at the correct grouping level
Builds the intermediate helper columns that drive the final answer
Uses direct text-pattern extraction instead of manual cleanup
Strengths:
- The R solution stays compact and mirrors the workbook logic closely.
Areas for Improvement:
- The code assumes the workbook layout and named ranges remain stable.
Gem:
- The best part of the solution is choosing a tidy intermediate shape before producing the final answer.
import pandas as pd
path = "files/2025-10-12/Challenge 70.xlsx"
input = pd.read_excel(path, usecols="B:C", skiprows=1, nrows=11)
test = pd.read_excel(path, usecols="E:F", skiprows=1, nrows=4).rename(columns=lambda col: col.replace('.1', ''))
input['Item'] = "Group " + input['Item'].str.contains("Group").cumsum().astype(str)
result = input.groupby('Item', as_index=False)['Prices'].sum()
print(result.equals(test))Logic:
Reads the workbook range needed for the challenge
Aggregates or ranks values at the correct grouping level
Strengths:
- The Python version keeps the same rule in a direct pandas-oriented workflow.
Areas for Improvement:
- As with the R version, any workbook layout change would require small adjustments.
Gem:
- The implementation stays close to the stated challenge instead of adding unnecessary complexity.
Difficulty Level
This task is moderate:
It combines familiar Excel-style logic with at least one non-trivial reshape, grouping, or parsing step.
The answer depends on getting the output layout exactly right.